package edu.gatech.app4args;

import edu.gatech.app4args.resources.Globals;

/**
 * Displays a RadioButton group allowing the user to select which type of
 * new slide they want to create.
 * 
 * @author Andrew Lunsford
 */
public class NewSlide extends javax.swing.JPanel {
	/** Stores the type of slide to create */
	private int selectedType;



    /** Creates new form NewSlide */
    public NewSlide() {
        initComponents();
		selectedType = Globals.sType_none;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jRadioButton3 = new javax.swing.JRadioButton();

        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(edu.gatech.app4args.App4Args.class).getContext().getResourceMap(NewSlide.class);
        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        buttonGroup1.add(jRadioButton1);
        jRadioButton1.setText(resourceMap.getString("jRadioButton1.text")); // NOI18N
        jRadioButton1.setIcon(resourceMap.getIcon("jRadioButton1.icon")); // NOI18N
        jRadioButton1.setName("jRadioButton1"); // NOI18N
        jRadioButton1.setSelectedIcon(resourceMap.getIcon("jRadioButton1.selectedIcon")); // NOI18N
        jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                titleSelected(evt);
            }
        });

        buttonGroup1.add(jRadioButton2);
        jRadioButton2.setText(resourceMap.getString("jRadioButton2.text")); // NOI18N
        jRadioButton2.setIcon(resourceMap.getIcon("jRadioButton2.icon")); // NOI18N
        jRadioButton2.setName("jRadioButton2"); // NOI18N
        jRadioButton2.setSelectedIcon(resourceMap.getIcon("jRadioButton2.selectedIcon")); // NOI18N
        jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                standardSelected(evt);
            }
        });

        buttonGroup1.add(jRadioButton3);
        jRadioButton3.setText(resourceMap.getString("jRadioButton3.text")); // NOI18N
        jRadioButton3.setIcon(resourceMap.getIcon("jRadioButton3.icon")); // NOI18N
        jRadioButton3.setName("jRadioButton3"); // NOI18N
        jRadioButton3.setSelectedIcon(resourceMap.getIcon("jRadioButton3.selectedIcon")); // NOI18N
        jRadioButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                twoContentSelected(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel1)
                    .add(layout.createSequentialGroup()
                        .add(jRadioButton1)
                        .add(18, 18, 18)
                        .add(jRadioButton2)))
                .add(18, 18, 18)
                .add(jRadioButton3))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel1)
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jRadioButton1)
                    .add(jRadioButton2)
                    .add(jRadioButton3))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

	/**
	 * Sets the selected slide type to Two Content.
	 * @param evt
	 */
	private void twoContentSelected(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_twoContentSelected
		selectedType = Globals.sType_two_content;
	}//GEN-LAST:event_twoContentSelected

	/**
	 * Sets the selected slide type to Standard.
	 * @param evt
	 */
	private void standardSelected(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_standardSelected
		selectedType = Globals.sType_standard;
	}//GEN-LAST:event_standardSelected

	/**
	 * Sets the selected slide type to Title
	 * @param evt
	 */
	private void titleSelected(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_titleSelected
		selectedType = Globals.sType_title;
	}//GEN-LAST:event_titleSelected

	/**
	 * Used to accessed the selected slide type.
	 * @return an int defined in Globals representing the slide type
	 */
	public int getSelected(){
		return selectedType;
	}

	public void setSelected(int selectedType) {
		this.selectedType = selectedType;
	}


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JRadioButton jRadioButton3;
    // End of variables declaration//GEN-END:variables

}
